<?php
/**********************
**intellistrip_server.inc
**Date Created: 4/13/2009
**Copyright 2009 Tomorrow Tech Industries
**Contact: RPITomorrowTech@gmail.com
**********************/
require_once('shared/intellistrip.inc');
/*  Had to move these to the bottom
require_once('shared/errors.inc');
require_once('shared/intellistrip.inc');
require_once('software_intellistrip_server.inc');
require_once('hardware_intellistrip_server.inc');
*****/
class IntellistripServer extends IntellistripActions
{
	/*********
	Private members
	********/
	//Our IntellistripServer object
	private static $server = null;

	/*********
	Initialization
	********/

	public function IntellistripServer()
	{
	}
	
	public static function setIntellistrip($intellistrip)
	{
		IntellistripServer::$server = $intellistrip;
	}
	
	//Factory pattern method
	public static function &getIntellistrip()
	{
		return IntellistripServer::$server;
	}

	/*********
	Accessor/mutator
	********/

	/*********
	XML-RPC called functions
	*********/
	
	public function setPortPower($portID, $powerLevel)
	{
		return TT_UNSUPPORTED;
	}

	//Get device power
	//
	public function getPortPower($portID, &$powerLevel)
	{
		return TT_UNSUPPORTED;
	}

	/********************
	Misc
	********************/
	/*******************
	Query device information
	Note this is NOT password protected
	This function is intended for rare queries to get full device status
	
	vendorName: vendor supplied name.
		modelNumber: a number unique with respect to a vendor name to identify 
			different products 
		serialNumber: a number unique to an individual device when combined
			with the vendor name and model number
		numberPorts: the number of ports availible on the device
		state: is the power strip on and availible?
	*******************/
	public function getIntellistripInformation(&$vendorName, &$modelNumber, 
									&$modelVersion, &$serialNumber,
									&$numberPorts, &$state)
	{
		return TT_UNSUPPORTED;
	}
	
	public function getNumberPorts(&$numberPorts)
	{
		return TT_UNSUPPORTED;
	}
	
	//changePassword
	//newPassword: what Intellistrip's authentication password will be set to if succeeded
	public function changePassword($newPassword)
	{
		return TT_UNSUPPORTED;
	}
	
	/*********
	Utility functions
	*********/

	public function isPasswordCorrect($enteredPassword)
	{
		if( $enteredPassword == $this->getServerPassword() )
		{
			return TT_OK;
		}
		else
		{
			return TT_ACCESS;
		}
	}
}

require_once('shared/errors.inc');
//require_once('shared/intellistrip.inc');
require_once('software_intellistrip_server.inc');
require_once('hardware_intellistrip_server.inc');

?>
